
//preloading.....
load("library/common.js");

JEuler.system.loadJS("library/math.js");

(function() {

    //JEuler.system.loadJS("data/???.dat");
    JEuler.system.printCaption("76");
    JEuler.system.startTimerCount();
    
    var way=[];
    
    function setWay(number, size, value) {
        way[size*1000+number] = value;
    }
    
    function getWay(number, size) {
        return way[size*1000+number] || -1;
    }
    
    function getValue(number, size) {
        if(size==1 || size==number) return 1;
        if(size>number) return 0;
        if(getWay(number,size)!=-1) return getWay(number, size);
        var sum=0;
        for(var i=1; i<=size; i++) {
            sum = sum + getValue(number-size, i);
        }
        setWay(number, size, sum);
        return sum;
    }
    
    var sum = 0;
    for(var i=2; i<=100; i++) {
        sum = sum + getValue(100, i);
        print(i+ "," +getValue(100, i));
    }
    

    JEuler.system.print("SUM=" + sum);
    JEuler.system.printTimerCount();
    
})();
